/**
 * @file drv_timer.c
 * @brief Code for drv_timer driver
 * @author He Shaohua (hsh15529870639@foxmail.com)
 * @date 2024-05-20
 * @version 1.0
 * @copyright Copyright (c) 2024, SNUT-Chaoyue Team
 * ****************************************************************************************************
 * @par Change Log:
 * <table>
 * <tr><th>Date         <th>Version       <th>Author      <th>Description
 * <tr><td>2024-05-20   <td> 1.0          <td>He Shaohua  <td>Creator
 *
 * </table>
 * ==================================----How to use this driver----=====================================
 * [..]
 * @note
 *   -#
 *
 * @warning
 *   -#
 *
 * *****************************************************************************************************
 * @attention
 *
 * This document is required and please understand any bugs that may occur in the document.
 * If you want to modify this file, after the code update is completed, update the version number in time,
 * indicate the update date, and fill in the changes
 * Make sure that the submitted code does not have many bugs.
 *
 * All rights reserved.
 * *****************************************************************************************************
 */

/* Includes ------------------------------------------------------------------*/
#include "drv_usart.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
/* Private typedef -----------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/**
 * @}
 */
  void USART1_DMA_Trans(uint8_t *TX_Data_Address, uint8_t dam_parm, uint16_t size)
  {
    DL_DMA_setDestAddr(DMA, dam_parm, (uint32_t)(&UART_0_INST->TXDATA));
    DL_DMA_setSrcAddr(DMA, dam_parm, (uint32_t)TX_Data_Address);
    DL_DMA_setTransferSize(DMA, dam_parm, size);
    DL_DMA_enableChannel(DMA, dam_parm);
  }

/**
 * @}
 */
void Vofa_printf(char *format, ...)
{
  uint8_t UART_Tx_Data[255];
  va_list arg_ptr;
  uint32_t length = 0;
  va_start(arg_ptr, format);
  length = vsnprintf((char *)UART_Tx_Data, 255, format, arg_ptr);
  va_end(arg_ptr);
  USART1_DMA_Trans(UART_Tx_Data, DMA_CH0_CHAN_ID, length);
}




/*********************************END OF FILE*********************************/
